home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / exelst.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  1KB  |  51 lines

  1. /*****************************************************************************
  2.  
  3.     ExeLst()
  4.  
  5.     This function executes a less-than-sign (<) command.
  6.     n<    Iterate n times
  7.  
  8. *****************************************************************************/
  9.  
  10. #include "zport.h"        /* define portability identifiers */
  11. #include "tecoc.h"        /* define general identifiers */
  12. #include "defext.h"        /* define external global variables */
  13. #include "deferr.h"        /* define identifiers for error messages */
  14.  
  15. DEFAULT ExeLst()                /* execute a  < command */
  16. {
  17.     DBGFEN(1,"ExeLst",NULL);
  18.  
  19.     if (++LStTop >= LPS_SIZE) {        /* if loop stack is full */
  20.         ErrMsg(ERR_PDO);        /* push-down list overflow */
  21.         DBGFEX(1,DbgFNm,"FAILURE");
  22.         return FAILURE;
  23.     }
  24.  
  25.     if (EStTop == EStBot) {            /* if no numeric argument */
  26.         NArgmt = INFINITE;        /* make it an infinite loop */
  27.     } else {
  28.         if (GetNmA() == FAILURE) {    /* get numeric argmument */
  29.             DBGFEX(1,DbgFNm,"FAILURE");
  30.             return FAILURE;
  31.         }
  32.         if (NArgmt <= 0) {        /* if null loop */
  33.             if (FlowEL()== FAILURE) { /* flow to end of loop */
  34.                 DBGFEX(1,DbgFNm,"FAILURE");
  35.                 return FAILURE;
  36.             }
  37.             CmdMod = '\0';        /* clear modifiers flags */
  38.             DBGFEX(1,DbgFNm,"SUCCESS");
  39.             return SUCCESS;
  40.         }
  41.     }
  42.  
  43.     LStack[LStTop].LIndex = NArgmt;        /* store loop index */
  44.     LStack[LStTop].LAddr = CBfPtr;        /* store loop start */
  45.  
  46.     CmdMod = '\0';                /* clear modifiers flags */
  47.  
  48.     DBGFEX(1,DbgFNm,"SUCCESS");
  49.     return SUCCESS;
  50. }
  51.